import axios from "@/request"

interface IUserLogin {
    pagenum: number,
    pagesize: number
}

function getArticles(params: IUserLogin) {
    return axios.get("/rest/articles", {
        params
    })
}

function delArticles(id: string) {
    return axios.delete("/rest/articles/" + id)
}

// 获取所属分类
function getCategories() {
    return axios.get("/rest/categories")
}

// 添加文章
function addArticles(params: any) {
    return axios.post("/rest/articles", {
        ...params
    })
}

// 获取详情
function getArticlesDetail(id: string) {
    return axios.get("/rest/articles/" + id)
}

// 更新详情
function putArticlesDetail(id: string, params: any) {
    return axios.put("/rest/articles/" + id, {
        ...params
    })
}



export {
    getArticles,
    delArticles,
    getCategories,
    addArticles,
    getArticlesDetail,
    putArticlesDetail
}